package com.x.crm.http.response;


import com.x.crm.DocDesc;

public class BaseResponse {
    @DocDesc("业务处理结果，success-成功，failure-失败")
    private String result;
    @DocDesc("业务处理结果的文字描述")
    private String message;
    @DocDesc("会话状态，normal-正常，timemout-超时")
    private String sessionStatus = "normal";

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static BaseResponse getSuccess(String message){
        BaseResponse response = new BaseResponse();
        response.result = "success";
        response.message = message;
        return response;
    }

    public static BaseResponse timeout(String message){
        BaseResponse response = new BaseResponse();
        response.result = "failure";
        response.message = message;
        response.sessionStatus = "timeout";
        return response;
    }
    public static BaseResponse fail(String message){
        BaseResponse response = new BaseResponse();
        response.result = "failure";
        response.message = message;
        return response;
    }

    public String getSessionStatus() {
        return sessionStatus;
    }

    public void setSessionStatus(String sessionStatus) {
        this.sessionStatus = sessionStatus;
    }
}
